Skip to content

Removing Vectorshape Usage #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Removing Vectorshape Usage #83

wants to merge 1 commit into from

Conversation

jposada202020
Copy link
Contributor

After CircuitPython 7.0.0 the usage of vectorshape has been deprecated. The current library has a rectangle_helper that uses it.


However after CP 7.0 this function becomes obsolete as the API for vectorio needs to add the shape to the group using the corresponding palette. Open for discussion, that having only the fill_area from bitmaptools will be easier than refactoring the cartesian to draw with both libraries. See documentation for vectorio.recatngle. So maybe there is a workaround but I could not find it during my tests.

group = displayio.Group()

palette = displayio.Palette(1)
palette[0] = 0x125690

rectangle = vectorio.Rectangle(pixel_shader=palette, width=40, height=30, x=55, y=45)
group.append(rectangle)

Cartesian is the only library using this, and is already hardcoded to use bitmaptool library only.

@tekktrik tekktrik requested a review from a team February 6, 2023 17:04
@FoamyGuy
Copy link
Contributor

FoamyGuy commented Feb 6, 2023

Thank you for the fix @jposada202020.

I tested this out on a Feather ESP32-S2 TFT. The changed version does no longer crash. But I noticed that it doesn't actually draw the rectangle either.

I think it's because it creates a vectorio rectangle object but doesn't return it or do anything else with it, so it's never added to the display or shown.

I think I am in favor of removing the bitmaptool argument altogether instead of fixing it to work with vectorio optionally. The only current usage of this helper has it hardcoded for bitmaptools anyhow, and the function would end up being kind of awkward if it had to return or add a vectorio shape since it behaves differently from the bitmap behavior which can "draw into" a given bitmap without needing to return or do anything else with it.

@jposada202020
Copy link
Contributor Author

Yes, Agreed with you, I have even tried to create a new palette object and the color_index passed to the function with no luck. I will work on the PR for the cartesian widget this week and put this one as a draft. Thanks :)

@jposada202020 jposada202020 marked this pull request as draft February 6, 2023 18:28
@jposada202020
Copy link
Contributor Author

see #84

@jposada202020 jposada202020 deleted the removing_vectorshape_usage branch February 6, 2023 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants